
<!-- content for head -->
<% content_for :head do %>
  <script type="text/javascript">
    $('#taskTab a:first').tab('show');
  </script>
<% end %>


        <div class="tabbable tabs-right">
          <ul id="taskTab" class="nav nav-tabs">
            <li><a href="#task_sumary" data-toggle="tab">总览</a></li>
          <% @tasks.each_with_index do |task, i| %>
            <li class=""><a href="#task_<%= i %>" data-toggle="tab"><%= task[:keyword] %></a></li>
          <% end %>
          </ul>
          <div class="tab-content">
            <div class="tab-pane" id="task_sumary">
              <div class="hero-unit">
                <h1>欢 迎</h1>
                <br>
                <p><%= tasks_summary_tag %></p>
                <p>
                  <a class="btn btn-primary btn-large" href="/histories?date=<%= Time.now.strftime('%Y-%m-%d') %>">
                    Learn more
                  </a>
                </p>
              </div>
            </div>
          <% @tasks.each_with_index do |task, i| %>
            <div class="tab-pane" id="task_<%= i %>">
              <% summary = Task.find(task[:_id]).get_summary %>
<!--               <div class="progress">
                <div class="bar bar-success" style="width: 35%;"></div>
                <div class="bar bar-warning" style="width: 20%;"></div>
                <div class="bar bar-danger" style="width: 10%;"></div>
              </div> -->

              <p><%= summary["total"] %></p>
              <p><%= summary["comment"] %></p>
              <p><%= summary["location"] %></p>
              <p><%= summary["time"] %></p>
              <%= link_to "详细", "histories/#{task[:_id]}" %>
            </div>
          <% end %>
          </div>

        </div>

<% content_for :foot do %>
  <script type="text/javascript">
    $('#taskTab a:first').tab('show');
  </script>
<% end %>